Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supports iOS 18+ runtime downloads #391

Merged
merged 6 commits into from
Oct 30, 2024

Conversation

spadafiva
Copy link
Contributor

@spadafiva spadafiva commented Oct 23, 2024

This PR attempts to port the logic from XcodesOrg/XcodesApp#622 to the CLI tool.

Fixes #384

The logic in the downloadAndInstallRuntime was modified to now switch over the runtime's content type. The previous existing package and disk image installs were left unchanged, but the .cryptexDiskImage case is now handled by the downloadAndInstallUsingXcodeBuild function.

This function does 3 main things (broken into some smaller helper functions for those).

  1. Check that we're using a new enough version of Xcode
  2. Start downloading using Xcodebuild and create an AsyncStream of the progress
  3. Write out that progress to the console

Testing:

In order to test this out you will need to have xcode 16.1 or newer installed.

Things I tested and seemed to work for me:

  1. try to install a runtime with the correct xcode selected
  2. try to install a cryptex runtime with a too low version selected

Caveats:

I'm not sure what happens to the underlying xcodebuild install process if you cancel the command from the terminal with CMD+C.

When the selected runtime is already installed, the tool will still go through the download process but complete quickly:

�[1A�[KDownloading Runtime iOS 18.1: 0%
�[1A�[KDownloading Runtime iOS 18.1: 0%
�[1A�[KDownloading Runtime iOS 18.1: 0%
�[1A�[KDownloading Runtime iOS 18.1: 0%
Finished

It might be worth following up in a future PR to check if the runtime is actually already installed instead of doing this.

@spadafiva spadafiva marked this pull request as ready for review October 24, 2024 17:42
@spadafiva spadafiva changed the title Gets downloads working a bit Fixes iOS 18+ runtime downloads Oct 24, 2024


private extension Progress {
func updateFromXcodebuild(text: String) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taken directly from the other PR

return AsyncThrowingStream<Progress, Swift.Error> { continuation in
Task {
// Assume progress will not have data races, so we manually opt-out isolation checks.
let progress = Progress()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More or less verbatim from the other PR

@spadafiva
Copy link
Contributor Author

@MattKiazyk guessing you’re busy with other work stuff, just wanted to bump this in case it got lost in the shuffle. Let me know if there’s anything else I can do

@MattKiazyk
Copy link
Contributor

@spadafiva sorry was trying to get login back up and working first. I'll look at this right away. Ok if I make any changes to your PR needed and just merge?

@spadafiva
Copy link
Contributor Author

@spadafiva sorry was trying to get login back up and working first. I'll look at this right away. Ok if I make any changes to your PR needed and just merge?

Sounds great! Thanks! Also, if there's anything I can to do help with the login stuff, would love to help out if I can.

@MattKiazyk
Copy link
Contributor

@spadafiva sorry was trying to get login back up and working first. I'll look at this right away. Ok if I make any changes to your PR needed and just merge?

Sounds great! Thanks! Also, if there's anything I can to do help with the login stuff, would love to help out if I can.

PR #393 is up that includes it, if you'd like to test.

@spadafiva
Copy link
Contributor Author

Also, @MattKiazyk, just in case it's not clear, thanks so much for maintaining the very useful tool. Me (and the the rest of the team) definitely appreciate how useful it is and the hard work you've put into maintaining it.

@MattKiazyk MattKiazyk added the enhancement New feature or request label Oct 30, 2024
@MattKiazyk MattKiazyk merged commit d1439a4 into XcodesOrg:main Oct 30, 2024
1 check passed
@MattKiazyk MattKiazyk changed the title Fixes iOS 18+ runtime downloads Supports iOS 18+ runtime downloads Oct 30, 2024
@spadafiva spadafiva deleted the joe/download-xcode-18-runtimes branch October 30, 2024 15:09
@ugenlik
Copy link

ugenlik commented Nov 13, 2024

@MattKiazyk could you add documentation on how to download runtimes, I am trying to automated a CLI pipeline and I want to download runtimes first before installing it

when I try this I get

xcodes runtimes download "iOS 18.1"
Error: Downloading runtime iOS 18.1 is not supported at this time. Please use `xcodes runtimes install "iOS 18.1"` instead.

why does it need to check if xcode installed first, I am just trying to download the package, otherwise I would have used install command

@spadafiva
Copy link
Contributor Author

@MattKiazyk could you add documentation on how to download runtimes, I am trying to automated a CLI pipeline and I want to download runtimes first before installing it

when I try this I get

xcodes runtimes download "iOS 18.1"
Error: Downloading runtime iOS 18.1 is not supported at this time. Please use `xcodes runtimes install "iOS 18.1"` instead.

why does it need to check if xcode installed first, I am just trying to download the package, otherwise I would have used install command

iOS 18.1 can't be ** just downloaded ** since it relies on the built in xcodebuild command now due to the changes on apple's side. So you can only install, it's not possible to download without installing.

@MattKiazyk
Copy link
Contributor

To clarify - Xcodes currently only wraps the install command of xcodebuild

There is a xcodebuild -exportPath command available to export the runtime, but xcodes hasn't implemented that yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iOS 18 runtime can not be downloaded
3 participants